//
import { Map } from "common/types";
import { distance, Matrix, Position, Point, Circle } from "common/geom";
import * as mvc from "common/mvc";
import * as dec from "common/decorator";
// ==========================================================================================
import * as dbtps from "../types";
import Library from "./library";
import PointerManager from "./pointer";
import { Armature, Bone, Slot, Display, Animation } from "./dragonBones";
/**
 * 舞台。
 */
export default class Stage extends mvc.Model {
    public static toString(): string {
        return "[class dragonBones.model.Stage]";
    }
    /**
     * 舞台类型。（影响布局）
     */
    @dec.addHistoryAndNotification(false, dbtps.MNotificationType.StageTypeChange)
    @dec.getterSetter(true, true)
    public stageType: dbtps.StageType = dbtps.StageType.Armature;
    /**
     * 舞台是否处于可见状态。
     */
    @dec.addHistoryAndNotification(false, dbtps.MNotificationType.StageVisibleChange)
    @dec.getterSetter(true, true)
    public visible: boolean = false;
    /**
     * 舞台缩放。
     */
    @dec.addHistoryAndNotification(false, dbtps.MNotificationType.StageScaleChange)
    @dec.getterSetter(true, true)
    public scale: number = 1.0;
    /**
     * 视窗水平坐标。
     */
    @dec.addHistoryAndNotification(false, dbtps.MNotificationType.StageMove)
    @dec.getterSetter(true, true)
    public x: number = 0;
    /**
     * 视窗垂直坐标。
     */
    @dec.addHistoryAndNotification(false, dbtps.MNotificationType.StageMove)
    @dec.getterSetter(true, true)
    public y: number = 0;
    /**
     * 视窗宽。
     */
    @dec.addHistoryAndNotification(false, dbtps.MNotificationType.StageResize)
    @dec.getterSetter(true, true)
    public width: number = 10;
    /**
     * 视窗高。
     */
    @dec.addHistoryAndNotification(false, dbtps.MNotificationType.StageResize)
    @dec.getterSetter(true, true)
    public height: number = 10;
    /**
     * 舞台坐标系到视窗坐标系变换。
     */
    public readonly stageToScreenMatrix: Matrix = new Matrix();
    /**
     * 视窗坐标系到舞台坐标系变换。
     */
    public readonly screenToStageMatrix: Matrix = new Matrix();
    /**
     * 指向实例。
     */
    public readonly hover: StageHoverable[] = [];
    /**
     * 选中实例。
     */
    public readonly selection: StageSelectable[] = [];
    /**
     * 嵌套编辑路径。
     */
    //public editPath: EditPair[] = [];
    /**
     * 当前骨架。
     */
    public armature: Armature;
    /**
     * 触控数据。
     */
    public readonly pointer: PointerManager = PointerManager.create(PointerManager);
    /**
     * 
     */
    public readonly visibleAndControl: VisibleAndControl = VisibleAndControl.create(VisibleAndControl);
}
/**
 * 
 */
class VisibleAndControl extends mvc.Model {
    public static toString(): string {
        return "[class dragonBones.model.VisibleAndControl]";
    }
    public boneVisible: boolean = true;
    public boneSelect: boolean = true;
    public boneInherit: boolean = true;
    public slotVisible: boolean = true;
    public slotSelect: boolean = true;
    public slotInherit: boolean = true;
}

type StageHoverable = Bone | Slot | Display;
type StageSelectable = Bone | Slot | Display;
//type EditPair = [Armature, AnimationState];